import { menulist } from '@/request/api'
export default{
    state:{
        menuList:[]
    },
    mutations:{
        mutation_menuList(state,payload){
            state.menuList = payload
        }
    },
    // 获取数据
    getters:{
        get_menuList(state){
            return state.menuList
        }
    },
    // 异步操作，请求数据
    actions:{
        async action_menuList({commit},payload){
            try{
                let  res = await menulist();
                if(res.code==200){
                    console.log(res);
                    commit('mutation_menuList',res.list)
                }
            }catch(err){
                console.log(err);
            }
        }
    },
    namespaced:true
}